import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    commentList: []
  },

  mutations: {
    getCommentList (state, payload) {
      state.commentList = payload
    }
  },

  getters: {
    filterTwoComment: state => {
      return state.commentList.filter((v, i) => i < 2)
    },

    isShowMoreComment: state => {
      return state.commentList.length >= 2
    }
  }
})

export default store
